﻿''' <summary>Generic Task schema</summary>
Public Class Task
    Inherits Indexable


    Public Sub New(ByVal content As String, ByVal format As IndexFormats, ByVal uri As String, ByVal last_modified_time As Date)
        MyBase.New(content, format)
        Me._uri = uri
        Me._last_modified_time = last_modified_time
    End Sub


    ''' <summary>Unique identifier </summary>
    ''' <remarks> required  </remarks>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _uri As String
    ''' <summary>Time last modified </summary>
    ''' <remarks> required  </remarks>
    Private _last_modified_time As Date



    ''' <summary>Title </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _title As String
    ''' <summary>Folder name </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _folder_name As String
    ''' <summary>Actual work completed (in hours) </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _actual_work As String
    ''' <summary>Task categories </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _categories As String
    ''' <summary>Companies </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _companies As String
    ''' <summary>Date task completed </summary>
    Private _date_completed As Date
    ''' <summary>Task start date </summary>
    Private _start_date As Date
    ''' <summary>Task due date </summary>
    Private _due_date As Date
    ''' <summary>Task importance </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _importance As Integer
    ''' <summary>Task percent complete </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _percent_complete As Integer
    ''' <summary>Total task work (in hours) </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _total_work As Integer
    ''' <summary>Task status </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _status As Integer
    ''' <summary>Task owner </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _owner As String
    ''' <summary>Task participants </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _participants As String
    ''' <summary>Describes how this task repeats </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _recurrence_pattern As String





    ''' <summary>Actual work completed (in hours) </summary>
    Public Property Actual_work() As String
        Get
            Return _actual_work
        End Get
        Set(ByVal value As String)
            _actual_work = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Task categories </summary>
    Public Property Categories() As String
        Get
            Return _categories
        End Get
        Set(ByVal value As String)
            _categories = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Companies </summary>
    Public Property Companies() As String
        Get
            Return _companies
        End Get
        Set(ByVal value As String)
            _companies = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Date task completed </summary>
    Public Property Date_completed() As Date
        Get
            Return _date_completed
        End Get
        Set(ByVal value As Date)
            _date_completed = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Task due date </summary>
    Public Property Due_date() As Date
        Get
            Return _due_date
        End Get
        Set(ByVal value As Date)
            _due_date = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Folder name </summary>
    Public Property Folder_name() As String
        Get
            Return _folder_name
        End Get
        Set(ByVal value As String)
            _folder_name = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Task importance </summary>
    Public Property Importance() As Integer
        Get
            Return _importance
        End Get
        Set(ByVal value As Integer)
            _importance = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Time last modified </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property Last_modified_time() As Date
        Get
            Return _last_modified_time
        End Get
    End Property
    ''' <summary>Task owner </summary>
    Public Property Owner() As String
        Get
            Return _owner
        End Get
        Set(ByVal value As String)
            _owner = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Task participants </summary>
    Public Property Participants() As String
        Get
            Return _participants
        End Get
        Set(ByVal value As String)
            _participants = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Task percent complete </summary>
    Public Property Percent_complete() As Integer
        Get
            Return _percent_complete
        End Get
        Set(ByVal value As Integer)
            _percent_complete = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Describes how this task repeats </summary>
    Public Property Recurrence_pattern() As String
        Get
            Return _recurrence_pattern
        End Get
        Set(ByVal value As String)
            _recurrence_pattern = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Task start date </summary>
    Public Property Start_date() As Date
        Get
            Return _start_date
        End Get
        Set(ByVal value As Date)
            _start_date = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Task status </summary>
    Public Property Status() As Integer
        Get
            Return _status
        End Get
        Set(ByVal value As Integer)
            _status = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Title </summary>
    Public Property Title() As String
        Get
            Return _title
        End Get
        Set(ByVal value As String)
            _title = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Total task work (in hours) </summary>
    Public Property Total_work() As Integer
        Get
            Return _total_work
        End Get
        Set(ByVal value As Integer)
            _total_work = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Unique identifier </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property Uri() As String
        Get
            Return _uri
        End Get
    End Property



    Protected Overrides Sub AddRequredProperties(ByVal e As [Event])
        MyBase.AddRequredProperties(e)


        e.AddProperty("uri", Me._uri)
        e.AddProperty("last_modified_time", Me._last_modified_time.ToOADate)
    End Sub

    Protected Overrides Sub AddOtherProperties(ByVal e As [Event])
        MyBase.AddOtherProperties(e)


        If Not String.IsNullOrEmpty(_title) Then e.AddProperty("title", _title)
        If Not String.IsNullOrEmpty(_folder_name) Then e.AddProperty("folder_name", _folder_name)
        If Not String.IsNullOrEmpty(_actual_work) Then e.AddProperty("actual_work", _actual_work)
        If Not String.IsNullOrEmpty(_categories) Then e.AddProperty("categories", _categories)
        If Not String.IsNullOrEmpty(_companies) Then e.AddProperty("companies", _companies)


        e.AddProperty("date_completed", Me._date_completed.ToOADate)
        e.AddProperty("start_date", Me._start_date.ToOADate)


        e.AddProperty("due_date", Me._due_date.ToOADate)
        e.AddProperty("importance", Me._importance)
        e.AddProperty("percent_complete", Me._percent_complete)

        e.AddProperty("total_work", Me._total_work)

        e.AddProperty("status", Me._status)

        If Not String.IsNullOrEmpty(_owner) Then e.AddProperty("owner", _owner)
        If Not String.IsNullOrEmpty(_participants) Then e.AddProperty("participants", _participants)
        If Not String.IsNullOrEmpty(_recurrence_pattern) Then e.AddProperty("recurrence_pattern", _recurrence_pattern)
        

    End Sub



End Class

